home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Tools - Objects / C++ / MPW C++ 3.1b1 / Examples / CPlusExamples / TESample.r < prev    next >
Text File  |  1989-09-29  |  7KB  |  286 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    CPlusTESample
  8. #
  9. #    TESample.r    -    Rez source
  10. #
  11. #    Copyright © 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #            1.10                     07/89
  16. #            1.00                     04/89
  17. #
  18. #    Components:
  19. #            CPlusTESample.make        July 9, 1989
  20. #            TApplicationCommon.h    July 9, 1989
  21. #            TApplication.h            July 9, 1989
  22. #            TDocument.h                July 9, 1989
  23. #            TECommon.h                July 9, 1989
  24. #            TESample.h                July 9, 1989
  25. #            TEDocument.h            July 9, 1989
  26. #            TApplication.cp            July 9, 1989
  27. #            TDocument.cp            July 9, 1989
  28. #            TESample.cp                July 9, 1989
  29. #            TEDocument.cp            July 9, 1989
  30. #            TESampleGlue.a            July 9, 1989
  31. #            TApplication.r            July 9, 1989
  32. #            TESample.r                July 9, 1989
  33. #
  34. #    CPlusTESample is an example application that demonstrates
  35. #    how to initialize the commonly used toolbox managers,
  36. #    operate successfully under MultiFinder, handle desk
  37. #    accessories and create, grow, and zoom windows. The
  38. #    fundamental TextEdit toolbox calls and TextEdit autoscroll
  39. #    are demonstrated. It also shows how to create and maintain
  40. #    scrollbar controls. 
  41. #
  42. #    This version of TESample has been substantially reworked in
  43. #    C++ to show how a "typical" object oriented program could
  44. #    be written. To this end, what was once a single source code
  45. #    file has been restructured into a set of classes which
  46. #    demonstrate the advantages of object-oriented programming.
  47. #
  48. ------------------------------------------------------------------------------*/
  49.  
  50. #include "SysTypes.r"
  51. #include "Types.r"
  52.  
  53. #include "TECommon.h"
  54.  
  55. resource 'vers' (1) {
  56.     0x01, 0x00, release, 0x00,
  57.     verUS,
  58.     "1.10",
  59.     "1.10, Copyright © 1989 Apple Computer, Inc."
  60. };
  61.  
  62. /* we use an MBAR resource to conveniently load all the menus */
  63.  
  64. resource 'MBAR' (rMenuBar, preload) {
  65.     { mApple, mFile, mEdit };        /* three menus */
  66. };
  67.  
  68.  
  69. resource 'MENU' (mApple, preload) {
  70.     mApple, textMenuProc,
  71.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  72.     enabled, apple,
  73.     {
  74.         "About CPlusTESample…",
  75.             noicon, nokey, nomark, plain;
  76.         "-",
  77.             noicon, nokey, nomark, plain
  78.     }
  79. };
  80.  
  81. resource 'MENU' (mFile, preload) {
  82.     mFile, textMenuProc,
  83.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  84.     enabled, "File",
  85.     {
  86.         "New",
  87.             noicon, "N", nomark, plain;
  88.         "Open",
  89.             noicon, "O", nomark, plain;
  90.         "-",
  91.             noicon, nokey, nomark, plain;
  92.         "Close",
  93.             noicon, "W", nomark, plain;
  94.         "Save",
  95.             noicon, "S", nomark, plain;
  96.         "Save As…",
  97.             noicon, nokey, nomark, plain;
  98.         "Revert",
  99.             noicon, nokey, nomark, plain;
  100.         "-",
  101.             noicon, nokey, nomark, plain;
  102.         "Page Setup…",
  103.             noicon, nokey, nomark, plain;
  104.         "Print…",
  105.             noicon, nokey, nomark, plain;
  106.         "-",
  107.             noicon, nokey, nomark, plain;
  108.         "Quit",
  109.             noicon, "Q", nomark, plain
  110.     }
  111. };
  112.  
  113. resource 'MENU' (mEdit, preload) {
  114.     mEdit, textMenuProc,
  115.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  116.     enabled, "Edit",
  117.      {
  118.         "Undo",
  119.             noicon, "Z", nomark, plain;
  120.         "-",
  121.             noicon, nokey, nomark, plain;
  122.         "Cut",
  123.             noicon, "X", nomark, plain;
  124.         "Copy",
  125.             noicon, "C", nomark, plain;
  126.         "Paste",
  127.             noicon, "V", nomark, plain;
  128.         "Clear",
  129.             noicon, nokey, nomark, plain
  130.     }
  131. };
  132.  
  133.  
  134. /* this ALRT and DITL are used as an About screen */
  135.  
  136. resource 'ALRT' (rAboutAlert, purgeable) {
  137.     {40, 20, 160, 330 }, rAboutAlert, {
  138.         OK, visible, silent;
  139.         OK, visible, silent;
  140.         OK, visible, silent;
  141.         OK, visible, silent
  142.     };
  143. };
  144.  
  145. resource 'DITL' (rAboutAlert, purgeable) {
  146.     { /* array DITLarray: 5 elements */
  147.         /* [1] */
  148.         {88, 224, 108, 304},
  149.         Button {
  150.             enabled,
  151.             "OK"
  152.         },
  153.         /* [2] */
  154.         {8, 8, 24, 304 },
  155.         StaticText {
  156.             disabled,
  157.             "MultiFinder-Aware C++ TextEdit Application"
  158.         },
  159.         /* [3] */
  160.         {32, 8, 48, 237},
  161.         StaticText {
  162.             disabled,
  163.             "Copyright © 1989 Apple Computer"
  164.         },
  165.         /* [4] */
  166.         {56, 8, 72, 136},
  167.         StaticText {
  168.             disabled,
  169.             "Brought to you by:"
  170.         },
  171.         /* [5] */
  172.         {80, 24, 112, 167},
  173.         StaticText {
  174.             disabled,
  175.             "Macintosh Developer  Technical Support"
  176.         }
  177.     }
  178. };
  179.  
  180.  
  181. resource 'WIND' (rDocWindow, preload, purgeable) {
  182.     {64, 60, 314, 460},
  183.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  184. };
  185.  
  186.  
  187. resource 'CNTL' (rVScroll, preload, purgeable) {
  188.     {-1, 385, 236, 401},
  189.     0, visible, 0, 0, scrollBarProc, 0, ""
  190. };
  191.  
  192.  
  193. resource 'CNTL' (rHScroll, preload, purgeable) {
  194.     {235, -1, 251, 386},
  195.     0, visible, 0, 0, scrollBarProc, 0, ""
  196. };
  197.  
  198. resource 'STR#' (kTEDocErrStrings, purgeable) {
  199.     {
  200.     "Not enough memory to run TESample";
  201.     "Not enough memory to do Cut";
  202.     "Cannot do Cut";
  203.     "Cannot do Copy";
  204.     "Cannot exceed 32,000 characters with Paste";
  205.     "Not enough memory to do Paste";
  206.     "Cannot create window";
  207.     "Cannot exceed 32,000 characters";
  208.     "Cannot do Paste"
  209.     }
  210. };
  211.  
  212. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  213.  
  214. resource 'SIZE' (-1) {
  215.     dontSaveScreen,
  216.     acceptSuspendResumeEvents,
  217.     enableOptionSwitch,
  218.     canBackground,        /* we can background; we don't currently, but our sleep value */
  219.                         /* guarantees we don't hog the Mac while we are in the background */
  220.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  221.     backgroundAndForeground, /* this is definitely note a background-only application! */
  222.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  223.     ignoreChildDiedEvents,
  224.     is32BitCompatible,
  225.     reserved, reserved, reserved, reserved,
  226.     reserved, reserved, reserved,
  227.     kPrefSize * 1024,
  228.     kMinSize * 1024
  229. };
  230.  
  231.  
  232. type 'MOOT' as 'STR ';
  233.  
  234.  
  235. resource 'MOOT' (0) {
  236.     "MultiFinder-Aware TextEdit Sample Application"
  237. };
  238.  
  239.  
  240. resource 'BNDL' (128) {
  241.     'MOOT',
  242.     0,
  243.     {
  244.         'ICN#',
  245.         {
  246.             0, 128
  247.         },
  248.         'FREF',
  249.         {
  250.             0, 128
  251.         }
  252.     }
  253. };
  254.  
  255.  
  256. resource 'FREF' (128) {
  257.     'APPL',
  258.     0,
  259.     ""
  260. };
  261.  
  262.  
  263. resource 'ICN#' (128) {
  264.     { /* array: 2 elements */
  265.         /* [1] */
  266.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  267.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  268.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  269.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  270.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  271.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  272.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  273.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  274.         /* [2] */
  275.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  276.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  277.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  278.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  279.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  280.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  281.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  282.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  283.     }
  284. };
  285.  
  286.